filechooserwidget: Use a bin layout
authorTimm Bäder <tbaeder@redhat.com>
Mon, 29 Apr 2019 09:21:53 +0000 (11:21 +0200)
committerTimm Bäder <mail@baedert.org>
Tue, 30 Apr 2019 03:36:20 +0000 (05:36 +0200)
Instead of implementing size_allocate and measure manually.

gtk/gtkfilechooserwidget.c

index 42e3782c541924f8688d24b05e7d143583171566..c66b23e8560dca025f96c37ac496c5290fbe30e0 100644 (file)
@@ -83,6 +83,7 @@
 #include "gtkfilechoosererrorstackprivate.h"
 #include "gtkentryprivate.h"
 #include "gtkroot.h"
+#include "gtkbinlayout.h"
 
 #include <cairo-gobject.h>
 
@@ -7933,39 +7934,6 @@ add_normal_and_shifted_binding (GtkBindingSet   *binding_set,
                                 signal_name, 0);
 }
 
-static void
-gtk_file_chooser_widget_measure (GtkWidget       *widget,
-                                 GtkOrientation  orientation,
-                                 int             for_size,
-                                 int            *minimum,
-                                 int            *natural,
-                                 int            *minimum_baseline,
-                                 int            *natural_baseline)
-{
-  GtkFileChooserWidget *self = GTK_FILE_CHOOSER_WIDGET (widget);
-  GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (self);
-
-  gtk_widget_measure (priv->box, orientation, for_size,
-                      minimum, natural,
-                      minimum_baseline, natural_baseline);
-}
-
-static void
-gtk_file_chooser_widget_size_allocate (GtkWidget *widget,
-                                       int        width,
-                                       int        height,
-                                       int        baseline)
-{
-  GtkFileChooserWidget *self = GTK_FILE_CHOOSER_WIDGET (widget);
-  GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (self);
-
-  gtk_widget_size_allocate (priv->box,
-                            &(GtkAllocation) {
-                              0, 0,
-                              width, height
-                            },-1);
-}
-
 static void
 gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
 {
@@ -7990,8 +7958,6 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
   widget_class->unroot = gtk_file_chooser_widget_unroot;
   widget_class->style_updated = gtk_file_chooser_widget_style_updated;
   widget_class->display_changed = gtk_file_chooser_widget_display_changed;
-  widget_class->measure = gtk_file_chooser_widget_measure;
-  widget_class->size_allocate = gtk_file_chooser_widget_size_allocate;
 
   /*
    * Signals
@@ -8558,6 +8524,8 @@ gtk_file_chooser_widget_init (GtkFileChooserWidget *impl)
    */
   post_process_ui (impl);
 
+  gtk_widget_set_layout_manager (GTK_WIDGET (impl), gtk_bin_layout_new ());
+
   profile_end ("end", NULL);
 }